﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Data;

namespace Convertor.Plugin.SendEmail
{
    class SmtpClientTemplateConverter : IMultiValueConverter
    {
        //public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        //{
        //    return ((SmtpClientViewModel)value).Host;
        //}

        //public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        //{
        //    var config = ((TemplateViewModel)value).TemplateContent;
        //    config.GetTemplate();
        //    return config;
        //}
        public object Convert(object[] values, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            return values[0] ?? string.Empty;
        }

        public object[] ConvertBack(object value, Type[] targetTypes, object parameter, System.Globalization.CultureInfo culture)
        {
            var config = ((TemplateViewModel)value).TemplateContent;
            return new object[] { config.Host, config.LoginName, config.Port, config.EnableSsl };
        }
    }
}
